home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Information / Digests / CSMP Digest / volume 3 / csmp-digest-v3-058 / doubleCR.1 < prev   
Encoding:
Text File  |  1995-12-31  |  64.7 KB  |  1,874 lines

  1. C.S.M.P. Digest             Thu, 15 Sep 94       Volume 3 : Issue 58
  2.  
  3. Today's Topics:
  4.  
  5.         AppleEvents for command line args (argc, argv)?
  6.         Exception Handling
  7.         NIM on develop, as of 19
  8.         Need to Stop flashing Desktop when changing palletes
  9.         PPostEvent mouse events
  10.         Sample MacTcp Programs
  11.         Selecting Window via menus
  12.         SetDialogDefaultItem real?
  13.         Stack sniffer - how can I turn it off?
  14.  
  15.  
  16.  
  17. The Comp.Sys.Mac.Programmer Digest is moderated by Francois Pottier
  18. (pottier@clipper.ens.fr).
  19.  
  20. The digest is a collection of article threads from the internet newsgroup
  21. comp.sys.mac.programmer.  It is designed for people who read c.s.m.p. semi-
  22. regularly and want an archive of the discussions.  If you don't know what a
  23. newsgroup is, you probably don't have access to it.  Ask your systems
  24. administrator(s) for details.  If you don't have access to news, you may
  25. still be able to post messages to the group by using a mail server like
  26. anon.penet.fi (mail help@anon.penet.fi for more information).
  27.  
  28. Each issue of the digest contains one or more sets of articles (called
  29. threads), with each set corresponding to a 'discussion' of a particular
  30. subject.  The articles are not edited; all articles included in this digest
  31. are in their original posted form (as received by our news server at
  32. nef.ens.fr).  Article threads are not added to the digest until the last
  33. article added to the thread is at least two weeks old (this is to ensure that
  34. the thread is dead before adding it to the digest).  Article threads that
  35. consist of only one message are generally not included in the digest.
  36.  
  37. The digest is officially distributed by two means, by email and ftp.
  38.  
  39. If you want to receive the digest by mail, send email to listserv@ens.fr
  40. with no subject and one of the following commands as body:
  41.     help                        Sends you a summary of commands
  42.     subscribe csmp-digest Your Name    Adds you to the mailing list
  43.     signoff csmp-digest            Removes you from the list
  44. Once you have subscribed, you will automatically receive each new
  45. issue as it is created.
  46.  
  47. The official ftp info is //ftp.dartmouth.edu/pub/csmp-digest.
  48. Questions related to the ftp site should be directed to
  49. scott.silver@dartmouth.edu. Currently no previous volumes of the CSMP
  50. digest are available there.
  51.  
  52. Also, the digests are available to WAIS users.  To search back issues
  53. with WAIS, use comp.sys.mac.programmer.src. With Mosaic, use
  54. http://www.wais.com/wais-dbs/comp.sys.mac.programmer.html.
  55.  
  56.  
  57. -------------------------------------------------------
  58.  
  59. >From rhn@waltz.engr.sgi.com (Ron Nicholson)
  60. Subject: AppleEvents for command line args (argc, argv)?
  61. Date: Wed, 24 Aug 1994 18:05:15 GMT
  62. Organization: Silicon Graphics, Inc., Mountain View, CA
  63.  
  64. Are there AppleEvents suitable for passing a unix style command line
  65. to a ported Unix C application?  I handle the 4 required AppleEvents
  66. in a wrapper, but that's not enough to pass all the args needed to
  67. a ported app.
  68.  
  69. Thanks,
  70.  
  71. Ronald H. Nicholson, Jr.    rhn@engr.sgi.com, rhn@netcom.com, N6YWU
  72. #include <canonical.disclaimer>     // I speak only for myself, etc.
  73.  
  74. +++++++++++++++++++++++++++
  75.  
  76. >From rhn@netcom.com (Ron Nicholson)
  77. Date: Thu, 1 Sep 1994 05:51:04 GMT
  78. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  79.  
  80. In article <Cv1wwr.4H2@odin.corp.sgi.com> I wrote:
  81. >Are there AppleEvents suitable for passing a unix style command line
  82. >to a ported Unix C application?  I handle the 4 required AppleEvents
  83. >in a wrapper, but that's not enough to pass all the args needed to
  84. >a ported app.
  85.  
  86. Thanks for all the replies.  Several people recommended using the
  87. DoScript ('dosc') command, part of the misc suite.  I tried using the
  88. DoScript command and it works just fine.
  89.  
  90. Inside my initialization code for the required handlers I added:
  91.  
  92.     err = AEInstallEventHandler('misc', kAEDoScript,
  93.                 NewAEEventHandlerProc(myHandleDoScript), 0, false);
  94.  
  95. // 'misc' == kAEMiscSuite ; couldn't find it in my headers files.
  96.  
  97. Inside the myHandleDoScript AE handler routine I used:
  98.  
  99.     err = AEGetParamPtr(aevt, keyDirectObject, typeChar,
  100.                 &typeCode, myParamTextBuffer, 256L, &actualSize);
  101.  
  102. This puts a string of text into myParamTextBuffer that can be parsed
  103. into parameters or commands (in the main loop, NOT in the handler).
  104.  
  105. Do I need to do anything else to make this bulletproof?
  106.  
  107. I needed an aete resource containing DoScript and the required
  108. AppleEvents.  I found one inside the ToolServer 1.1 application.  I
  109. just copied it since I don't have an aete editor.
  110.  
  111. I'm going to try this for porting standalone unix filters like grep.
  112. >>> Tell application "grep" to DoScript "grep -i foo somefile.txt"
  113. Something like "grep bar < infile > outfile" should work for unix style
  114. file names in a default directory.  I suppose something like this could
  115. be packaged up with a dropshell to make it a scriptshell.
  116.  
  117. - -
  118. Ronald H. Nicholson, Jr.    rhn@netcom.com, rhn@engr.sgi.com, N6YWU
  119. #include <canonical.disclaimer>     // I speak only for myself, etc.
  120.  
  121.  
  122. ---------------------------
  123.  
  124. >From stara@holmes.ece.orst.edu (Aaron Starr)
  125. Subject: Exception Handling
  126. Date: 29 Aug 1994 18:58:11 GMT
  127. Organization: College of Engineering, Oregon State University
  128.  
  129.  
  130. Until we have a compiler that supports exception handling, I need to use
  131. some sort of approximation in my code.  Anyone have any preferences?
  132.  
  133. I know that Symantec has an exception library for TCL, as well as a
  134. Bedrock exception library, and I know that Metrowerks has something
  135. similar for PowerPlant.  Does anyone know which of these is most similar
  136. to likely implementations in the compiler?
  137.  
  138. Thanks for info,
  139.  
  140. Aaron Starr
  141. stara@ece.orst.edu
  142.  
  143. +++++++++++++++++++++++++++
  144.  
  145. >From afcjlloyd@aol.com (AFC JLloyd)
  146. Date: 30 Aug 1994 02:59:30 -0400
  147. Organization: America Online, Inc. (1-800-827-6364)
  148.  
  149. Aaron Starr (stara@holmes.ece.orst.edu ) writes:
  150.  
  151. >Until we have a compiler that supports exception handling, I need to use
  152. >some sort of approximation in my code.  Anyone have any preferences?
  153. >I know that Symantec has an exception library for TCL, as well as a
  154. >Bedrock exception library, and I know that Metrowerks has something
  155. >similar for PowerPlant.  Does anyone know which of these is most similar
  156. >to likely implementations in the compiler?
  157.  
  158. I'm the engineer who did most of the work on BEL.  If your criteria is
  159. compatibility to the C++ standard, then I think BEL is your best choice. 
  160. Of course, I'm biased, but let me try to give you enough facts so that you
  161. can make an objective decision.
  162.  
  163. The original TCL exception handling implementation made no attempt to
  164. throw/catch objects, and no attempt to delete stack-based objects as the
  165. stack is unwound.
  166.  
  167. The PowerPlant mechanism does not throw objects, though it does delete
  168. stack-based objects.  However, it calls constructors for partially
  169. constructed objects, and doesn't prevent memory leaks when exceptions are
  170. thrown from constructors of objects that are being allocated from the
  171. heap.
  172.  
  173. BEL does throw/catch objects; in fact, BEL only throws objects.  It
  174. doesn't allow throwing of arbitrary types like integers and strings.  Of
  175. course, you can package integers and strings inside exception classes of
  176. your own design.
  177.  
  178. BEL properly deletes stack based objects as the stack is unwound. 
  179. Destructors are called only for fully constructed objects.  However, BEL
  180. doesn't do this automatically; you must insert a macro call at the end of
  181. every constructor and the start of every destructor for the classes that
  182. need automatic cleanup.  You must also derive such classes from a special
  183. class.  If you use multiple inheritance there are some restrictions; the
  184. major one being that you can't inherit from the special "CAutoDestruct"
  185. class more than once, and virtual base classes are not supported.  If you
  186. use mixin style inheritance, then your mixin classes should not be derived
  187. from CAutoDestruct.
  188.  
  189. BEL also handles the case where an object is allocated from the heap using
  190. operator new and an exception is thrown from the constructor.  In this
  191. case, the raw memory allocated (with ::operator new()) must be deleted by
  192. the exception handling mechanism.
  193.  
  194. The BEL macros that implement the programming interface are designed to be
  195. compatible with the C++ exception handling syntax.  When compilers provide
  196. exception handling, BEL's macros can be redefined to the C++ syntax.  You
  197. can then recompile your code without making any changes to take advantage
  198. of the compilers support.  Of course, you can then globally replace the
  199. macros with the real syntax, but there may be good reasons to continue
  200. using the macros for a while.   For example, an implementation of BEL for
  201. Windows exists, so if you write cross platform code using BEL you will
  202. want to wait to use the true C++ syntax until all of your compilers
  203. support exceptions (and do so relatively bug-free).
  204.  
  205. Finally, even though Bedrock is no more, the OpenDoc Parts Framework (OPF)
  206. is being developed with BEL.  I am now a contractor at Apple working on
  207. OPF, and I am enhancing BEL as part of the contract.
  208.  
  209. What is the downside to BEL?  The main issue is performance and code size.
  210.  There are lots of things a compiler can do that can't be done using
  211. portable C++ code; that is why Stroustrup wanted exceptions in the
  212. language, and not just a part of the standard library.  You'll have to
  213. settle with some overhead until the compilers implement exceptions.  There
  214. are of course other compromises.
  215.  
  216. Jim Lloyd
  217. afcjlloyd@aol.com  -or- Jim_Lloyd@powertalk.apple.com
  218.  
  219.  
  220. +++++++++++++++++++++++++++
  221.  
  222. >From jahess@metrowerks.com (Jonathan Hess)
  223. Date: 30 Aug 1994 18:53:50 GMT
  224. Organization: ViviStar Consulting
  225.  
  226. In article <33tb43$1r2@engr.orst.edu>
  227. stara@holmes.ece.orst.edu (Aaron Starr) writes:
  228.  
  229. > I know that Symantec has an exception library for TCL, as well as a
  230. > Bedrock exception library, and I know that Metrowerks has something
  231. > similar for PowerPlant.  Does anyone know which of these is most similar
  232. > to likely implementations in the compiler?
  233.  
  234. TCL 2 uses the Bedrock exception library "BEL."  Once you get past the
  235. macros, BEL probably is closer to C++ exceptions for throwing actual
  236. objects and the like.
  237.  
  238. But, if you like simplicity, UExceptions from PowerPlant is REAL clean.
  239.  
  240. In both cases you'll probably be able to global GREP search and
  241. replaces for C++ exceptions.
  242.  
  243. As for my personal preference... well I'm biased.   :)
  244.  
  245. , Jonathan Hess
  246. Metrowerks, Inc.
  247. jahess@metrowerks.com
  248.  
  249. +++++++++++++++++++++++++++
  250.  
  251. >From afcjlloyd@aol.com (AFC JLloyd)
  252. Date: 31 Aug 1994 03:16:03 -0400
  253. Organization: America Online, Inc. (1-800-827-6364)
  254.  
  255. In article <33vv7u$7i4@tracker.ramp.com>, jahess@metrowerks.com (Jonathan
  256. Hess) writes:
  257.  
  258. >In article <33tb43$1r2@engr.orst.edu>
  259. >stara@holmes.ece.orst.edu (Aaron Starr) writes:
  260. >
  261. >> I know that Symantec has an exception library for TCL, as well as a
  262. >> Bedrock exception library, and I know that Metrowerks has something
  263. >> similar for PowerPlant.  Does anyone know which of these is most
  264. similar
  265. >> to likely implementations in the compiler?
  266. >
  267. >TCL 2 uses the Bedrock exception library "BEL."  Once you get past the
  268. >macros, BEL probably is closer to C++ exceptions for throwing actual
  269. >objects and the like.
  270. >
  271. >But, if you like simplicity, UExceptions from PowerPlant is REAL clean.
  272. >
  273. >In both cases you'll probably be able to global GREP search and
  274. >replaces for C++ exceptions.
  275. >
  276. >As for my personal preference... well I'm biased.   :)
  277.  
  278. The number one design criteria for BEL was to be "sufficiently" close to
  279. the C++ standard.  To achieve this we wanted application developers to be
  280. able to write exception handling code in almost exactly the same style
  281. they would use with C++ exceptions, with only minimal restrictions, and
  282. that code written using BEL could be recompiled without changes and work
  283. correctly when compilers support C++ exceptions.
  284.  
  285. Alas, this criteria often precluded simplicity.
  286.  
  287. As it happens, I spend a little of my spare time working on an idea I have
  288. for an educational game.  The exception library I wrote for it is even
  289. simpler than PowerPlant's UExceptions.  You see, I too believe that for
  290. some applications, simplicity is more important than adherence to some
  291. external standard.
  292.  
  293. Jim Lloyd
  294. afcjlloyd@aol.com -or- Jim_Lloyd@powertalk.apple.com
  295.  
  296.  
  297. +++++++++++++++++++++++++++
  298.  
  299. >From sparent@mv.us.adobe.com (Sean Parent)
  300. Date: Wed, 31 Aug 1994 20:49:22 GMT
  301. Organization: Adobe Systems Incorporated
  302.  
  303. How does BEL handle the case of an auto-destruct member within another
  304. auto-destruct derived class? That is, how do you handle:
  305.  
  306. class CFoo : CAutoDestruct {
  307.    ...
  308. }
  309. class CBar : CAutoDestruct {
  310.    CFoo  fooMember;
  311. }
  312.  
  313. void Test {
  314.    CBar bar;
  315.    CFoo foo;
  316.    Failure(); // or throw
  317. }
  318.  
  319. You need to thread foo and bar onto your exception stack but not fooMember
  320. (since it's destructor will get called when bar is destructed).
  321.  
  322. Sean
  323.  
  324. In article <341anj$sv3@search01.news.aol.com>, afcjlloyd@aol.com (AFC
  325. JLloyd) wrote:
  326.  
  327. > In article <33vv7u$7i4@tracker.ramp.com>, jahess@metrowerks.com (Jonathan
  328. > Hess) writes:
  329. > >In article <33tb43$1r2@engr.orst.edu>
  330. > >stara@holmes.ece.orst.edu (Aaron Starr) writes:
  331. > >
  332. > >> I know that Symantec has an exception library for TCL, as well as a
  333. > >> Bedrock exception library, and I know that Metrowerks has something
  334. > >> similar for PowerPlant.  Does anyone know which of these is most
  335. > similar
  336. > >> to likely implementations in the compiler?
  337. > >
  338. > >TCL 2 uses the Bedrock exception library "BEL."  Once you get past the
  339. > >macros, BEL probably is closer to C++ exceptions for throwing actual
  340. > >objects and the like.
  341. > >
  342. > >But, if you like simplicity, UExceptions from PowerPlant is REAL clean.
  343. > >
  344. > >In both cases you'll probably be able to global GREP search and
  345. > >replaces for C++ exceptions.
  346. > >
  347. > >As for my personal preference... well I'm biased.   :)
  348. > The number one design criteria for BEL was to be "sufficiently" close to
  349. > the C++ standard.  To achieve this we wanted application developers to be
  350. > able to write exception handling code in almost exactly the same style
  351. > they would use with C++ exceptions, with only minimal restrictions, and
  352. > that code written using BEL could be recompiled without changes and work
  353. > correctly when compilers support C++ exceptions.
  354. > Alas, this criteria often precluded simplicity.
  355. > As it happens, I spend a little of my spare time working on an idea I have
  356. > for an educational game.  The exception library I wrote for it is even
  357. > simpler than PowerPlant's UExceptions.  You see, I too believe that for
  358. > some applications, simplicity is more important than adherence to some
  359. > external standard.
  360. > Jim Lloyd
  361. > afcjlloyd@aol.com -or- Jim_Lloyd@powertalk.apple.com
  362.  
  363. -- 
  364. Sean Parent
  365. sparent@mv.us.adobe.com
  366. "The critical driver of every successful project is its focused ruthlessness."
  367.         Grady Booch
  368.  
  369. +++++++++++++++++++++++++++
  370.  
  371. >From objfactory@aol.com (ObjFactory)
  372. Date: 1 Sep 1994 16:48:03 -0400
  373. Organization: America Online, Inc. (1-800-827-6364)
  374.  
  375. In article <sparent-3108941249220001@macb041.mv.us.adobe.com>,
  376. sparent@mv.us.adobe.com (Sean Parent) writes:
  377.  
  378. >How does BEL handle the case of an auto-destruct member within another
  379. >auto-destruct derived class? That is, how do you handle:
  380.  
  381. >class CFoo : CAutoDestruct {
  382. >   ...
  383. >}
  384. >class CBar : CAutoDestruct {
  385. >   CFoo  fooMember;
  386. >}
  387.  
  388. >void Test {
  389. >   CBar bar;
  390. >   CFoo foo;
  391. >   Failure(); // or throw
  392. >}
  393.  
  394. >You need to thread foo and bar onto your exception stack but not
  395. fooMember
  396. >(since it's destructor will get called when bar is destructed).
  397.  
  398. You seem to have answered your own question. :)
  399.  
  400. Bob Foster
  401. Object Factory
  402.  
  403. +++++++++++++++++++++++++++
  404.  
  405. >From afcjlloyd@aol.com (AFC JLloyd)
  406. Date: 1 Sep 1994 18:13:09 -0400
  407. Organization: America Online, Inc. (1-800-827-6364)
  408.  
  409. In article <345em3$a1d@search01.news.aol.com>, objfactory@aol.com
  410. (ObjFactory) writes:
  411.  
  412. >In article <sparent-3108941249220001@macb041.mv.us.adobe.com>,
  413. >sparent@mv.us.adobe.com (Sean Parent) writes:
  414. >
  415. >>How does BEL handle the case of an auto-destruct member within another
  416. >>auto-destruct derived class? That is, how do you handle:
  417. >
  418. >>class CFoo : CAutoDestruct {
  419. >>   ...
  420. >>}
  421. >>class CBar : CAutoDestruct {
  422. >>   CFoo  fooMember;
  423. >>}
  424. >
  425. >>void Test {
  426. >>   CBar bar;
  427. >>   CFoo foo;
  428. >>   Failure(); // or throw
  429. >>}
  430. >
  431. >>You need to thread foo and bar onto your exception stack but not
  432. >fooMember
  433. >>(since it's destructor will get called when bar is destructed).
  434. >
  435. >You seem to have answered your own question. :)
  436. >
  437. >Bob Foster
  438. >Object Factory
  439.  
  440. No, BEL threads all three objects on the delete stack, but Sean's
  441. assumption that the fooMember is on the top of the stack is incorrect --
  442. subobjects are constructed before their owning object.  So, the stack
  443. order at the time of failure is:
  444.  
  445. bar.fooMember; bar; foo;
  446.  
  447. BEL first calls foo.CFoo::~CFoo(), then calls bar.CBar::~CBar.  The
  448. destructor of CBar implicitly calls the destructor
  449. bar.fooMember.CFoo::~CFoo().  Inside this destructor is the
  450. START_DESTRUCTOR macro, which informs BEL to pop the deletestack entry for
  451. bar.fooMember.  When the destructor returns to BEL, the delete stack is
  452. now empty, so BEL doesn't try to delete bar.fooMember.
  453.  
  454. This strategy results in more items being placed onto the delete stack
  455. than is theoretically necessary, but less computation at runtime to
  456. determine if an entry should be pushed onto the stack or not.  We
  457. therefore have traded off a little extra storage for faster code.
  458.  
  459. Jim Lloyd - AFC JLloyd
  460.  
  461.  
  462. ---------------------------
  463.  
  464. >From nick+@pitt.edu ( nick.c )
  465. Subject: NIM on develop, as of 19
  466. Date: Wed, 31 Aug 94 14:50:26 GMT
  467. Organization: The Pitt, Chemistry
  468.  
  469.  
  470. Folks:
  471.  
  472.     Someone was asking about the new NIM policy for _develop_, and what
  473.       volumes would be on 19 that weren't on 18.  Just got 19, and noticed
  474.       the absense of the Old IM and beta QD GX books, but they added as 
  475.       "specials" Sound and Imaging with Quickdraw.  Here's a running
  476.       index of NIM I'm keeping for my own use, with 19 added.
  477.       If you have issue 17 and up you have 15 of the NIM, with 7 (beta) 
  478.       QD GX books, the Human Interface guidelines and Old IM VI.
  479.       
  480.     BTW, I saw a CD at the bookstore with the Human Interface Guidelines
  481.       and _Making it Macintosh_ on one CD for $49.  Anyone checked this
  482.       out?  There has got to be more on it that just that, but the package
  483.       wasn't very helpfull.
  484.       
  485.                                         -- nick
  486.  
  487.  
  488.  
  489. develop NIM Index:
  490. ~~~~~~~~~~~~~~~~~~
  491.  
  492. volume 17: (last "comprehensive")
  493. =================================
  494.  
  495.   NIM (presume "core")
  496.     Toolbox Essentials
  497.     More Mac Toolbox
  498.     Memory
  499.     Files
  500.   
  501.   NIM (unique this CD)
  502.     Overview
  503.     Processes
  504.     Devices (Preview)
  505.     Interapplication Comm
  506.     QuickTime
  507.     QuickTime Components
  508.     Text
  509.  
  510.   QD GX 1.0b3 <- Note beta
  511.     Environment & Utilities
  512.     Extensions & Drivers
  513.     Functin Index
  514.     Graphics
  515.     Objects
  516.     Printing
  517.     Typography
  518.     
  519.   Misc.
  520.     Human Interface Guidelines
  521.     Old IM volume VI
  522.  
  523.  
  524. volume 18: (first "reduced")
  525. ============================
  526.     
  527.   NIM (presume "core")
  528.     Toolbox Essentials
  529.     More Mac Toolbox
  530.     Memory
  531.     Files
  532.  
  533.   NIM (unique this CD)
  534.     PowerPC Numerics
  535.     PowerPC System Software
  536.  
  537.   QD GX b3 <- Note beta
  538.     Environment & Utilities
  539.     Extensions & Drivers
  540.     Functin Index
  541.     Graphics
  542.     Objects
  543.     Printing
  544.     Typography
  545.     
  546.   Misc.
  547.     Human Interface Guidelines
  548.     Old IM volume VI
  549.  
  550.  
  551. volume 19: (second "reduced")
  552. =============================
  553.     
  554.   NIM (presume "core")
  555.     Toolbox Essentials
  556.     More Mac Toolbox
  557.     Memory
  558.     Files
  559.  
  560.   NIM (unique this CD)
  561.     Imaging With Quickdraw
  562.     Sound
  563.  
  564.   Misc.
  565.     Human Interface Guidelines
  566.  
  567.  
  568. The README explanation of new NIM policy:
  569. =========================================
  570.  
  571. Why aren't all of the volumes of New Inside Macintosh on this
  572. issue of the Bookmark CD?
  573.  
  574. Later this year, Apple and Addison-Wesley will release the
  575. New Inside Macintosh (NIM) CD.  The NIM CD will offer all
  576. Inside Macintosh volumes to date in Apple DocViewer format,
  577. a complete cross reference, and numerous prebuilt DocViewer
  578. collections to allow easy querying across the information. 
  579. All of the NIM books, if purchased separately, would cost
  580. several hundred dollars. The complete electronic set,
  581. however, will be offered at the introductory price of $99
  582. (suggested retail price).
  583.  
  584. To avoid conflicts, the introduction of this product has
  585. caused us to alter our practice of providing all NIM volumes
  586. on the Bookmark CD.  Because the low subscription price for
  587. develop and the Bookmark cannot support the necessary
  588. enhancements, updates, and wider distribution of the
  589. electronic NIM product, we've had to make some concessions. 
  590. The initial plan was to simply remove all NIM content from
  591. the Bookmark CD.  We realize, however, that this content is
  592. extremely important to a great many of you and that it is
  593. necessary for your development projects.  
  594.  
  595. So, we've compromised a bit - beginning with this CD, the
  596. Bookmark will include a core set of NIM volumes. 
  597. Additionally, each issue of the Bookmark CD will feature
  598. other volumes of NIM.  The core set will stay fairly
  599. consistent, but the featured volumes will change on each
  600. subsequent issue of the Bookmark CD. 
  601.  
  602. While this solution may not be optimal for all develop
  603. subscribers, it was a compromise that was necessary to make.
  604.  We hope, of course, that you feel that develop and the
  605. other content on the Bookmark CD is well worth the low
  606. subscription price.
  607.  
  608. Sincerely,
  609. The develop and Bookmark CD team
  610.  
  611. - -
  612.  
  613.  
  614.  
  615.                                     _/   _/  _/  _/_/_/   _/   _/  
  616.      Interet: nick@pitt.edu        _/_/ _/  _/  _/   _/  _/_/_/    
  617.       eWorld: nick                _/ _/_/  _/  _/       _/ _/      
  618.          CIS: 71232,766          _/   _/  _/   _/_/_/  _/   _/     
  619.  
  620.  
  621. +++++++++++++++++++++++++++
  622.  
  623. >From nick+@pitt.edu ( nick.c )
  624. Date: Wed, 31 Aug 94 15:15:54 GMT
  625. Organization: The Pitt, Chemistry
  626.  
  627.  
  628.     
  629.     This might be more usefull.
  630.  
  631.                         -- nick
  632.  
  633. - -
  634.  
  635.  
  636. develop NIM Index:
  637. ~~~~~~~~~~~~~~~~~~
  638.  
  639.     NIM: Toolbox Essentials             ANY develop (17up)
  640.     NIM: More Mac Toolbox               ANY develop (17up)
  641.     NIM: Memory                         ANY develop (17up)
  642.     NIM: Files                          ANY develop (17up)
  643.     
  644.     NIM: Overview                       17  develop
  645.     NIM: Processes                      17  develop
  646.     NIM: Devices (Preview)              17  develop
  647.     NIM: Interapplication Comm          17  develop
  648.     NIM: QuickTime                      17  develop
  649.     NIM: QuickTime Components           17  develop
  650.     NIM: Text                           17  develop
  651.     
  652.     NIM: Imaging With Quickdraw         19  develop
  653.     NIM: Sound                          19  develop
  654.     
  655.     NIM: PowerPC Numerics               18  develop
  656.     NIM: PowerPC System Software        18  develop ___ 15 volumes
  657.     
  658.     NIM: QD/GX Environment & Utilities  17 or 18 develop
  659.     NIM: QD/GX Extensions & Drivers     17 or 18 develop
  660.     NIM: QD/GX Functin Index            17 or 18 develop
  661.     NIM: QD/GX Graphics                 17 or 18 develop
  662.     NIM: QD/GX Objects                  17 or 18 develop
  663.     NIM: QD/GX Printing                 17 or 18 develop
  664.     NIM: QD/GX Typography               17 or 18 develop ___ 7 volumes
  665.     
  666.     Human Interface Guidelines          ANY develop (17up)
  667.     Old IM volume VI                    17 or 18 develop
  668.     
  669.  
  670.  
  671.                                     _/   _/  _/  _/_/_/   _/   _/  
  672.      Interet: nick@pitt.edu        _/_/ _/  _/  _/   _/  _/_/_/    
  673.       eWorld: nick                _/ _/_/  _/  _/       _/ _/      
  674.          CIS: 71232,766          _/   _/  _/   _/_/_/  _/   _/     
  675.  
  676.  
  677. ---------------------------
  678.  
  679. >From jflet@dir.mcc.ac.uk (J. Fletcher)
  680. Subject: Need to Stop flashing Desktop when changing palletes
  681. Date: Tue, 30 Aug 1994 18:28:53 GMT
  682. Organization: University of Manchester, UK
  683.  
  684.  
  685. I'm writing a small database application which displays 256 colour
  686. picts in a window. As I swap in different pictures, I set a new
  687. optimised pallette to get the best colour scheme possible.
  688.  
  689. The problem is that every time a set a new palatte, everything 
  690. flashes all over the place, scroll bars, desktop pattern etc.
  691.  
  692. What steps can I use to minimise these visual irritations?
  693.  
  694. I've got some ideas but does Anybody have any ideas on how to
  695. implement the following :-
  696.  
  697. 1) Get the Desktop pattern, save it, Set it to a black/white
  698. checkerboard 'grey' ands restore at app. quit time.
  699.  
  700. 2) Force all screen windows to display their window bar/controls
  701. in neat black/white (like setting to black/white only in monitors
  702. CP) yet allowing colour drawing.
  703.  
  704. Julian
  705. jflet@dir.mcc.ac.uk
  706.  
  707. +++++++++++++++++++++++++++
  708.  
  709. >From radixinc@aol.com (RadixInc)
  710. Date: 30 Aug 1994 18:34:01 -0400
  711. Organization: America Online, Inc. (1-800-827-6364)
  712.  
  713. In article <jflet-300894192149@grice.ch.man.ac.uk>, jflet@dir.mcc.ac.uk
  714. (J. Fletcher) writes:
  715.  
  716. <<The problem is that every time a set a new palatte, everything 
  717. flashes all over the place, scroll bars, desktop pattern etc.
  718.  
  719. What steps can I use to minimise these visual irritations?
  720.  
  721. I've got some ideas but does Anybody have any ideas on how to
  722. implement the following :-
  723.  
  724. 1) Get the Desktop pattern, save it, Set it to a black/white
  725. checkerboard 'grey' ands restore at app. quit time.
  726.  
  727. 2) Force all screen windows to display their window bar/controls
  728. in neat black/white (like setting to black/white only in monitors
  729. CP) yet allowing colour drawing.>>
  730.  
  731. The problem is inherent in the way the Pallette Manager and color devices
  732. work. The video card for each device has a table with and RGB entry for
  733. each color entry--there are 256 of them on an 8-bit card. When you change
  734. pallettes the Pallette Manager tries to keep everything in order, but if
  735. there aren't enough available (unused) colors in the color table it has to
  736. remap some colors, and that's when you get the flash and weird colors.
  737.  
  738. Both of the solutions you propose are, in my opinion, worse than the
  739. problem. You would be making changes that affect other programs, and there
  740. is no way to tell what that will do to them. Fiddling with the desktop
  741. pattern is not a good idea; that should be under the user's control. And
  742. how would you force other apps to get only B&W controls without installing
  743. a patch at startup time? Also what will you do when your app is switched
  744. out--flip everything back? That will cause more flashing than the pallette
  745. problem.
  746.  
  747. If you can't use the System Pallette, you'll have to live with the colors
  748. flashing.
  749.  
  750. Gregory Jorgensen
  751. Radix Consulting Inc.
  752.  
  753. +++++++++++++++++++++++++++
  754.  
  755. >From hanrek@cts.com (Mark Hanrek)
  756. Date: 31 Aug 1994 09:19:24 GMT
  757. Organization: The Information Workshop
  758.  
  759. > In article <jflet-300894192149@grice.ch.man.ac.uk>, jflet@dir.mcc.ac.uk
  760. > (J. Fletcher) writes:
  761. > <<The problem is that every time a set a new palatte, everything 
  762. > flashes all over the place, scroll bars, desktop pattern etc.
  763.  
  764. The problem is that we've forgotten that "the flash" is the tradeoff we
  765. had accepted for the benefit of being able to use custom color tables,
  766. which usually yield stunning color accuracy and realism for a 256-color
  767. system.
  768.  
  769. There are "ways" to minimize the effects.
  770.  
  771. * Use a gamma fader to fade down the monitor between pictures to hide the flash.
  772.  
  773. * Utilize a "backdrop window" with a gray pattern (alternate black and
  774. white pixels) to hide the desktop and other application's windows, since
  775. black and white are always in every custom color table, and will not
  776. flash.
  777.  
  778. * Use a black backdrop which is traditional with the "slide show" options
  779. of most graphics applications.
  780.  
  781. * Always make sure the display window is full screen.
  782.  
  783. * Always create greedy palettes with all hte entries always set to
  784. pmTolerant + pmExplicity and a tolerance of zero, so that all other
  785. applications and the Finder are forced to black and white mode.
  786.  
  787. Hopefully one of these suggestions will help.
  788.  
  789. There are only 256 colors available in the hardware, and that's it.
  790.  
  791.  
  792. Mark Hanrek
  793.  
  794. +++++++++++++++++++++++++++
  795.  
  796. >From carlf2@aol.com (CarlF2)
  797. Date: 31 Aug 1994 09:45:08 -0400
  798. Organization: America Online, Inc. (1-800-827-6364)
  799.  
  800. In article <jflet-300894192149@grice.ch.man.ac.uk>, jflet@dir.mcc.ac.uk
  801. (J. Fletcher) writes:
  802.  
  803. >I'm writing a small database application which displays 256 colour
  804. >picts in a window. As I swap in different pictures, I set a new
  805. >optimised pallette to get the best colour scheme possible.
  806.  
  807. >The problem is that every time a set a new palatte, everything 
  808. >flashes all over the place, scroll bars, desktop pattern etc.
  809.  
  810. >......[deleted]
  811.  
  812. Try using a single animated palette for your application, with every entry
  813. but black and white reserved for your application. (This will force the
  814. background applications to use B&W; if you can, you might leave some other
  815. entries for them to use as well.) Then when you want to change your
  816. colors, use AnimatePalette. Since no other application is using those
  817. entries, no flash will occur.
  818.  
  819. Carl Fristrom
  820. Medfield MA
  821.  
  822. ---------------------------
  823.  
  824. >From sbill@informix.com (Bill Stackhouse)
  825. Subject: PPostEvent mouse events
  826. Date: 26 Aug 1994 20:25:24 GMT
  827. Organization: Informix Software, Inc.
  828.  
  829. I am trying to post mouseUp and mouseDown events to my application
  830. using PPostEvent. After call PPostEvent, the what field is set to
  831. -1. The return value is 0. If I scan the event queue, there are
  832. no events. Even though I set the mouse position using low mem
  833. globals before the post, the where field has a different value
  834. than where the mouse is.
  835.  
  836. What does it take to post mouse events?
  837.  
  838. Thanks
  839. Bill
  840.  
  841. +++++++++++++++++++++++++++
  842.  
  843. >From pbonner@pbcomputing.com (Pace Bonner)
  844. Date: 29 Aug 1994 18:01:19 GMT
  845. Organization: PB Computing
  846.  
  847. In article <33lj3k$k08@infmx.informix.com>, sbill@informix.com (Bill
  848. Stackhouse) wrote:
  849.  
  850. > I am trying to post mouseUp and mouseDown events to my application
  851. > using PPostEvent. After call PPostEvent, the what field is set to
  852. > -1. The return value is 0. If I scan the event queue, there are
  853. > no events. Even though I set the mouse position using low mem
  854. > globals before the post, the where field has a different value
  855. > than where the mouse is.
  856. > What does it take to post mouse events?
  857.  
  858. Try this code....It works for me.
  859.  
  860.         /* do a mouse down with correct cmd keys */
  861. void MakeMouse(where,Mods)
  862. Point             where;
  863. short             Mods;
  864. {
  865.     EvQEl            *MyEventPtr;
  866.     OsErr            err;
  867.  
  868.     err = PPostEvent(mouseDown, 0, &MyEventPtr);
  869.     MyEventPtr->evtQWhere.h = where.h;
  870.     MyEventPtr->evtQWhere.v = where.v;
  871.     MyEventPtr->evtQModifiers = Mods;
  872.     
  873.     err = PPostEvent(mouseUp, 0, &MyEventPtr);
  874.     MyEventPtr->evtQWhere.h = where.h;
  875.     MyEventPtr->evtQWhere.v = where.v;
  876.     MyEventPtr->evtQModifiers = Mods;
  877.     
  878. }
  879.  
  880. +------------------------------------------------------------------------+
  881. Pace Bonner                Macintosh & Newton        512.335.1033
  882. PB Computing              Software Development       11100 Spear Oak Cove
  883. pbonner@pbcomputing.com         Services             Austin, TX 78759-7004
  884. +------------------------------------------------------------------------+
  885.  
  886. +++++++++++++++++++++++++++
  887.  
  888. >From rollin@newton.apple.com (Keith Rollin)
  889. Date: Thu, 01 Sep 1994 19:42:04 -0800
  890. Organization: Apple ][ -> Mac -> Taligent -> Newton -> Windows?
  891.  
  892. In article <33lj3k$k08@infmx.informix.com>, sbill@informix.com (Bill
  893. Stackhouse) wrote:
  894.  
  895. >I am trying to post mouseUp and mouseDown events to my application
  896. >using PPostEvent. After call PPostEvent, the what field is set to
  897. >-1. The return value is 0. If I scan the event queue, there are
  898. >no events. Even though I set the mouse position using low mem
  899. >globals before the post, the where field has a different value
  900. >than where the mouse is.
  901. >
  902. >What does it take to post mouse events?
  903.  
  904. This is the way I did it for Macintosh Programming Secrets:
  905.  
  906.                 PPostEvent(mouseDown, 0, &qElPtr);
  907.                 qElPtr->evtQWhere = location;
  908.                 PPostEvent(mouseUp, 0, &qElPtr);
  909.                 qElPtr->evtQWhere = location;
  910.  
  911. This code has always worked for me so far. I don't know if there are any
  912. A/UX issues.
  913.  
  914. - --------------------------------------------------------------------------
  915. Keith Rollin --- Phantom Programmer --- Apple Computer, Inc. --- Team Newton
  916.  
  917. ---------------------------
  918.  
  919. >From U086753@adpdp2.lanl.gov (Jeff Dunning)
  920. Subject: Sample MacTcp Programs
  921. Date: Wed, 31 Aug 94 18:49:44 GMT
  922. Organization: Los Alamos National lab.
  923.  
  924. I am looking for a couple of sample MacTcp programs. Where might some be found.
  925.  
  926. Thanks. 
  927. jsd@lanl.gov
  928. Jeff Dunning
  929. Los Alamos National Laboratory
  930. (505)667-8418
  931.  
  932. +++++++++++++++++++++++++++
  933.  
  934. >From hanrek@cts.com (Mark Hanrek)
  935. Date: 31 Aug 1994 20:52:10 GMT
  936. Organization: The Information Workshop
  937.  
  938. In article <U086753.1128746624A@newshost.lanl.gov>, jsd@lanl.gov wrote:
  939.  
  940. > I am looking for a couple of sample MacTcp programs. 
  941. > Where might some be found?
  942.  
  943.  
  944. Jeff,
  945.  
  946. Here are some leads to resources...
  947.  
  948.  
  949.   * Snippets/network section of Developer CD
  950.  
  951.   * Snippets section of ftp://ftp.apple.com/
  952.  
  953.   * ftp://seeding.apple.com/mactcp/MacTCP_Dev_Kit
  954.  
  955.   * articles in "develop" magazine ftp://ftp.apple.com
  956.  
  957.   * source code archives everywhere
  958.       ( start at nic.switch.ch )
  959.  
  960.  
  961. This should help. :)
  962.  
  963. Mark Hanrek
  964.  
  965. +++++++++++++++++++++++++++
  966.  
  967. >From resnick@uiuc.edu (Pete Resnick)
  968. Date: Wed, 31 Aug 1994 18:16:38 -0500
  969. Organization: University of Illinois at Urbana-Champaign
  970.  
  971. In article <hanrek-3108941354220001@auke.cts.com>, hanrek@cts.com (Mark
  972. Hanrek) wrote:
  973.  
  974. >In article <U086753.1128746624A@newshost.lanl.gov>, jsd@lanl.gov wrote:
  975. >
  976. >> I am looking for a couple of sample MacTcp programs. 
  977. >> Where might some be found?
  978. >
  979. >Here are some leads to resources...
  980. >
  981. >  * Snippets/network section of Developer CD
  982. >
  983. >  * Snippets section of ftp://ftp.apple.com/
  984.  
  985. Eeeek!!! No, don't use those as examples. They're horribly written,
  986. useless pieces of code. They do synchronous I/O that will hang your
  987. machine. Just say no!
  988.  
  989. >  * ftp://seeding.apple.com/mactcp/MacTCP_Dev_Kit
  990.  
  991. I don't believe there is any code in there.
  992.  
  993. >  * articles in "develop" magazine ftp://ftp.apple.com
  994.  
  995. Don't look at the articles by Steve Falkenburg. Same warning as above on
  996. Snippets.
  997.  
  998. >  * source code archives everywhere
  999. >      ( start at nic.switch.ch )
  1000.  
  1001. Also look at the NewsWatcher source code--
  1002.  
  1003. ftp://ftp.acns.nwu.edu//pub/newswatcher/source-20b9.sea.hqx
  1004.  
  1005. And some of Peter Lewis's stuff (which should be lots of places).
  1006.  
  1007. pr
  1008. -- 
  1009. Pete Resnick        (...so what is a mojo, and why would one be rising?)
  1010. Doctoral Student - Philosophy Department, Gregory Hall, UIUC
  1011. System manager - Cognitive Science Group, Beckman Institute, UIUC
  1012. Internet: resnick@uiuc.edu
  1013.  
  1014. ---------------------------
  1015.  
  1016. >From jbeeghly@u.washington.edu (Jeff Beeghly)
  1017. Subject: Selecting Window via menus
  1018. Date: 31 Aug 1994 17:37:50 GMT
  1019. Organization: University of Washington
  1020.  
  1021.  
  1022. I'm creating an app that will contain multiple windows that are 
  1023. dynamically created and destroyed.  I was keeping track of each window 
  1024. and it's data via a linked-list, but some friends of mine said that the 
  1025. "Mac way of handling multiple child windows is to use window reference 
  1026. values".
  1027.  
  1028.  
  1029. So I converted my app from using linked-lists to using window references 
  1030. (not an easy task, mind you) and I'm finding out that this method has 
  1031. several setbacks compared to my original method, one of which is bringing 
  1032. a window to the front via menus.
  1033.  
  1034. I was digging through THINK Reference and I found out that a Window 
  1035. Record contains a pointer to the next window.  Well, I implemented a test 
  1036. into my program that displays the title of each child window:
  1037.  
  1038. i = 0;
  1039. whichWindow = FrontWindow();
  1040. while( whichWindow )
  1041. {
  1042.     GetWTitle(whichWindow, title);
  1043.     MoveTo(4, 10 + i);
  1044.     DrawString(title);
  1045.     whichWindow = (WindowPtr )(((WindowPeek )whichWindow)->nextWindow);
  1046.     i += 20;
  1047. }
  1048.  
  1049. I'm comming across 2 problems with this:
  1050. 1) In my app, if I create 4 new windows, then invoke this operation, only 
  1051. the top window's (window #4) title is displayed.  However, if I click on 
  1052. one of the other windows (causing the window to be moved to the front), 
  1053. then invoke this function, all four titles appear.  Thus, if I was to use 
  1054. this implementation of getting a list of windows, it wouldn't be valid 
  1055. until one of the windows was topped.
  1056.  
  1057. 2) Even when the items are displayed, they aren't displayed in the order 
  1058. in which they were created.  In other words, if I create 4 new windows, 
  1059. then select window #1 to come up, I would expect to see the titles of 
  1060. win1, win2, win3, win4 displayed.  Instead, I get win1, win4, win3, win2.  
  1061. I've tested this out a bit more, and it seems that the nextWindow points 
  1062. to the window underneath the current window, not the window that was created 
  1063. after the current window.
  1064.  
  1065. This makes sense, but it doesn't help me out.  What I was going to do was 
  1066. have a counter.  If menu item #2 was selected, then that must mean that 
  1067. the second window needs to be topped.  I would then imcrement the window 
  1068. pointer to the second created window and select it.  Obviously this will 
  1069. not work.
  1070.  
  1071. So right now I'm thinking about creating an array holding the window pointers
  1072. and it would look something like this:
  1073.  
  1074. menuItem = 2;  // The third window needs to be topped
  1075.  
  1076. winPtr = ourArray[ menuItem ];
  1077.  
  1078. SelectWindow( winPtr );
  1079.  
  1080.  
  1081. I was wondering: Is there an easier (and more standardised) way of doing 
  1082. this?  Are there any code examples of this floating around?
  1083.  
  1084.  
  1085. P.S.  I have thought about comparing the string in the menu item with the 
  1086. title of the window.  The problem is this:  What do you do if you have 
  1087. two windows with the same title?  Suppose you have two files from two 
  1088. different folders opened with the same name?  I know that some apps add a 
  1089. number at the end of the name (MyDoc:1 vs MyDoc:2), but personally, I 
  1090. don't like doing that.
  1091.  
  1092.  
  1093. +++++++++++++++++++++++++++
  1094.  
  1095. >From bb@lightside.com (Bob Bradley)
  1096. Date: Tue, 30 Aug 1994 02:03:58 -0800
  1097. Organization: SS Software Inc.
  1098.  
  1099. In article <342f5e$2mf@news.u.washington.edu>, jbeeghly@u.washington.edu
  1100. (Jeff Beeghly) wrote:
  1101.  
  1102. > I was digging through THINK Reference and I found out that a Window 
  1103. > Record contains a pointer to the next window.  Well, I implemented a test 
  1104. > into my program that displays the title of each child window:
  1105. > i = 0;
  1106. > whichWindow = FrontWindow();
  1107. > while( whichWindow )
  1108. > {
  1109. >         GetWTitle(whichWindow, title);
  1110. >         MoveTo(4, 10 + i);
  1111. >         DrawString(title);
  1112. >         whichWindow = (WindowPtr )(((WindowPeek )whichWindow)->nextWindow);
  1113. >         i += 20;
  1114. > }
  1115. > I'm comming across 2 problems with this:
  1116. > 1) In my app, if I create 4 new windows, then invoke this operation, only 
  1117. > the top window's (window #4) title is displayed.  However, if I click on 
  1118. > one of the other windows (causing the window to be moved to the front), 
  1119. > then invoke this function, all four titles appear.  Thus, if I was to use 
  1120. > this implementation of getting a list of windows, it wouldn't be valid 
  1121. > until one of the windows was topped.
  1122.  
  1123. One probably you may be having is you may be drawing in a part of the
  1124. window that isn't visible so it's not showing up. Accessing the nextWindow
  1125. field of the WindowRecord doesn't select the window. Try moving your
  1126. windows apart so you know the part you are trying to draw into is visible
  1127. (normally you would always do any drawing from your updateEvt handler.).
  1128.  
  1129. > 2) Even when the items are displayed, they aren't displayed in the order 
  1130. > in which they were created.  In other words, if I create 4 new windows, 
  1131. > then select window #1 to come up, I would expect to see the titles of 
  1132. > win1, win2, win3, win4 displayed.  Instead, I get win1, win4, win3, win2.  
  1133. > I've tested this out a bit more, and it seems that the nextWindow points 
  1134. > to the window underneath the current window, not the window that was created 
  1135. > after the current window.
  1136.  
  1137. You are correct, nextWindow points to the window beneath the current
  1138. window. You can use this to step down thru your windows one beneath the
  1139. other.
  1140.  
  1141. > This makes sense, but it doesn't help me out.  What I was going to do was 
  1142. > have a counter.  If menu item #2 was selected, then that must mean that 
  1143. > the second window needs to be topped.  I would then imcrement the window 
  1144. > pointer to the second created window and select it.  Obviously this will 
  1145. > not work.
  1146.  
  1147. There is an example of keeping track of windows in a menu in the book Mac
  1148. Programming Secrets (Keith Rollin and Scott Knaster) and the source is
  1149. available almost everyway (usually named MPS 1.0.1). They keep track of
  1150. the order which the windows were created and access the windows via menus
  1151. in the same manner.
  1152.  
  1153. Another way you could do it is to attach some private data to the window
  1154. that contains a variable to keep track of which menuItem # the window goes
  1155. with, then write a simple routine to step thru the window list (using
  1156. nextWindow) checking each window's private data for the menuItem # you're
  1157. trying to find.
  1158.  
  1159. +++++++++++++++++++++++++++
  1160.  
  1161. >From Matt Slot <fprefect@engin.umich.edu>
  1162. Date: 1 Sep 1994 01:43:11 GMT
  1163. Organization: University of Michigan
  1164.  
  1165. Jeff Beeghly, jbeeghly@u.washington.edu writes:
  1166.  > I was wondering: Is there an easier (and more standardised) way of doing 
  1167.  > this?  Are there any code examples of this floating around?
  1168.  
  1169. - ---------
  1170.  
  1171. I have just written such a beast. Here is some sample code that handles
  1172. a windows menu. The default menu looks like this...
  1173.  
  1174.     Windows
  1175.     --------------------
  1176.     Show/Hide Floater #1
  1177.     Show/Hide Floater #2
  1178.  
  1179. And I add a separator when I put any document windows underneath.
  1180. Basically, I keep a Mac Queue of window information, that is ordered by
  1181. window creation. As I make, destroy, or rename a window, I make the
  1182. appropriate call and I am magically taken care of. I map the index of the
  1183. menu item into the element of the queue.
  1184.     
  1185. Share and enjoy
  1186.  
  1187. Matt
  1188.     
  1189. // * **************************************************************************** * //
  1190. // * **************************************************************************** * //
  1191. // Menu Item numbers
  1192.  
  1193. #define    kWindowsFloater1        1
  1194. #define    kWindowsFloater2        2
  1195. #define    kWindowsSeparator1        3
  1196.  
  1197. // * **************************************************************************** * //
  1198.  
  1199. typedef struct WindowQElem {
  1200.     struct WindowQElem qLink;
  1201.     short qType;
  1202.     WindowPtr win;
  1203.     } WindowQElem, *WindowQElemPtr;
  1204.         
  1205. // * **************************************************************************** * //
  1206.  
  1207. QHdr gDocsOpen;
  1208.  
  1209. // * **************************************************************************** * //
  1210.  
  1211. void AddToWindowsMenu(WindowPtr win) {
  1212.     Str255 textBuff;
  1213.     MenuHandle theMenu;
  1214.     WindowQElemPtr wQPtr;
  1215.     
  1216.     theMenu = GetMenu(kWindowsMenuID);
  1217.     if (CountMItems(theMenu) < kWindowsSeparator1)
  1218.         InsMenuItem(theMenu, "\p-", kWindowsSeparator1);
  1219.     
  1220.     if (wQPtr = (WindowQElemPtr) NewPtrClear(sizeof(*wQPtr))) {
  1221.         
  1222.         wQPtr->win = win;
  1223.         Enqueue((QElemPtr) wQPtr, &gDocsOpen);
  1224.  
  1225.         AppendMenu(theMenu, "\p ");
  1226.         GetWTitle(win, textBuff);
  1227.         SetItem(theMenu, CountMItems(theMenu), textBuff);
  1228.         
  1229.         DrawMenuBar();
  1230.         }
  1231.     }
  1232.  
  1233. // * **************************************************************************** * //
  1234. // * **************************************************************************** * //
  1235.  
  1236. void ModifyFromWindowsMenu(WindowPtr win) {
  1237.     short i;
  1238.     Str255 textBuff;
  1239.     MenuHandle theMenu;
  1240.     WindowQElemPtr wQPtr;
  1241.     
  1242.     theMenu = GetMenu(kWindowsMenuID);
  1243.     
  1244.     for(wQPtr = (WindowQElemPtr) gDocsOpen.qHead, i=0; wQPtr;
  1245.             wQPtr = wQPtr->next, i++)
  1246.         if (wQPtr->win == win) {
  1247.             GetWTitle(win, textBuff);
  1248.             SetItem(theMenu, kWindowsFirstWinItem + i, textBuff);
  1249.             DrawMenuBar();
  1250.  
  1251.             return;
  1252.             }
  1253.  
  1254.     }
  1255.  
  1256. // * **************************************************************************** * //
  1257. // * **************************************************************************** * //
  1258.  
  1259. void RemoveFromWindowsMenu(WindowPtr win) {
  1260.     short i;
  1261.     Str255 textBuff;
  1262.     MenuHandle theMenu;
  1263.     WindowQElemPtr wQPtr;
  1264.     
  1265.     theMenu = GetMenu(kWindowsMenuID);
  1266.     
  1267.     for(wQPtr = (WindowQElemPtr) gDocsOpen.qHead, i=0; wQPtr;
  1268.             wQPtr = wQPtr->next, i++)
  1269.         if ((wQPtr->win == win) && ! Dequeue((QElemPtr) wQPtr, &gDocsOpen)) {
  1270.             DelMenuItem(theMenu, kWindowsFirstWinItem + i);
  1271.             if (CountMItems(theMenu) == kWindowsSeparator1)
  1272.                 DelMenuItem(theMenu, kWindowsSeparator1);
  1273.             DrawMenuBar();
  1274.  
  1275.             return;
  1276.             }
  1277.     }
  1278.  
  1279. +++++++++++++++++++++++++++
  1280.  
  1281. >From h+@nada.kth.se (Jon W{tte)
  1282. Date: Thu, 01 Sep 1994 14:55:32 +0200
  1283. Organization: Royal Institute of Something or other
  1284.  
  1285. In article <342f5e$2mf@news.u.washington.edu>,
  1286. jbeeghly@u.washington.edu (Jeff Beeghly) wrote:
  1287.  
  1288. >whichWindow = FrontWindow();
  1289. >while( whichWindow )
  1290. >{
  1291. >    GetWTitle(whichWindow, title);
  1292. >    MoveTo(4, 10 + i);
  1293. >    DrawString(title);
  1294. >    whichWindow = (WindowPtr )(((WindowPeek )whichWindow)->nextWindow);
  1295. >    i += 20;
  1296. >}
  1297.  
  1298. This looks quite allright.
  1299.  
  1300. >1) In my app, if I create 4 new windows, then invoke this operation, only 
  1301. >the top window's (window #4) title is displayed.  However, if I click on 
  1302. >one of the other windows (causing the window to be moved to the front), 
  1303. >then invoke this function, all four titles appear.  Thus, if I was to use 
  1304.  
  1305. This is strange. You're probably doing something wrong in 
  1306. creating and showing the windows. Or maybe you're now showing 
  1307. the windows? FrontWindow() returns the frontmost VISIBLE 
  1308. window. If you want to get the list of ALL windows, you have to 
  1309. use LMGetWindowList() and walk from there.
  1310.  
  1311. >2) Even when the items are displayed, they aren't displayed in the order 
  1312. >in which they were created.  In other words, if I create 4 new windows, 
  1313. >then select window #1 to come up, I would expect to see the titles of 
  1314. >win1, win2, win3, win4 displayed.  Instead, I get win1, win4, win3, win2.  
  1315.  
  1316. Yes; the titles come up in the order they lie in the layers. If 
  1317. you create each new window on top of the preceeding window, 
  1318. it'll be before it in the list.
  1319.  
  1320. Cheers,
  1321.  
  1322.                 / h+
  1323.  
  1324.  
  1325. --
  1326.   Jon W‰tte (h+@nada.kth.se), Hagagatan 1, 113 48 Stockholm, Sweden
  1327.  
  1328.   Reality exists only in your imagination.
  1329.  
  1330.  
  1331. ---------------------------
  1332.  
  1333. >From phixus@netcom.com (Chris DeSalvo)
  1334. Subject: SetDialogDefaultItem real?
  1335. Date: Wed, 17 Aug 1994 08:28:47 GMT
  1336. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  1337.  
  1338. Think Reference mentions two traps:
  1339.  
  1340. SetDialogDefaultItem and
  1341. SetDialogCancelItem
  1342.  
  1343. They are supposed to take care of button hiliting, outlining, and
  1344. keyboard mapping of things like return/enter and escape.
  1345.  
  1346. The traps are definied in the Universal Headers but they don't seem to
  1347. work.  They are not documented in the Dialog Manager section of
  1348. NIM:Toolbox Essentials.
  1349.  
  1350. Are these entries just place holders or is there some magic I have not
  1351. learned to get them to work?
  1352.  
  1353.  
  1354. Thanx
  1355. Chris
  1356. -- 
  1357. +-----------------------------------------------------------------+
  1358. | phixus@netcom.com           |   Macintosh:  Changing the world, |
  1359. | Chris De Salvo              |        one person at a time!      |
  1360. | Professional Mac Geek       |    -----------------------------  |
  1361. | for MacPlay, Inc.           |      (I wish they'd hurry up!)    |
  1362. +-----------------------------------------------------------------+
  1363.  
  1364. Any opinions expressed, or implied, are my own!  They should not be
  1365. considered representative of the opinions or policies of my employer,
  1366. MacPlay, a division of Interplay Productions, Inc.
  1367.  
  1368. +++++++++++++++++++++++++++
  1369.  
  1370. >From spencerl@crl.com (Spencer Low)
  1371. Date: Wed, 17 Aug 1994 12:24:56 -0800
  1372. Organization: LowTek Creations
  1373.  
  1374. In article <phixusCuo7K0.Fzr@netcom.com>, phixus@netcom.com (Chris DeSalvo)
  1375. wrote:
  1376. > The traps are definied in the Universal Headers but they don't seem to
  1377. > work.  They are not documented in the Dialog Manager section of
  1378. > NIM:Toolbox Essentials.
  1379.  
  1380. Make sure that you don't have an extension that messes with ModalDialog
  1381. filter procs - I was running the cool Escapade, but it seemed to stop this
  1382. "default" behavior.
  1383.  
  1384. If you have your own custom filter proc, make sure it calls the Standard
  1385. proc with GetStdFilterProc().
  1386.  
  1387. Spencer (please correct me if I'm wrong..)
  1388.  
  1389. +++++++++++++++++++++++++++
  1390.  
  1391. >From phixus@netcom.com (Chris DeSalvo)
  1392. Date: Thu, 18 Aug 1994 11:03:40 GMT
  1393. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  1394.  
  1395. Spencer Low (spencerl@crl.com) wrote:
  1396. : In article <phixusCuo7K0.Fzr@netcom.com>, phixus@netcom.com (Chris DeSalvo)
  1397. : wrote:
  1398. : > The traps are definied in the Universal Headers but they don't seem to
  1399. : > work.  They are not documented in the Dialog Manager section of
  1400. : > NIM:Toolbox Essentials.
  1401.  
  1402. : If you have your own custom filter proc, make sure it calls the Standard
  1403. : proc with GetStdFilterProc().
  1404.  
  1405. That is probably the case, I do indeed have a custom event filter on
  1406. this dialog.  I will check it out.
  1407.  
  1408. Thanx
  1409. Chris
  1410. -- 
  1411. +-----------------------------------------------------------------+
  1412. | phixus@netcom.com           |   Macintosh:  Changing the world, |
  1413. | Chris De Salvo              |        one person at a time!      |
  1414. | Professional Mac Geek       |    -----------------------------  |
  1415. | for MacPlay, Inc.           |      (I wish they'd hurry up!)    |
  1416. +-----------------------------------------------------------------+
  1417.  
  1418. Any opinions expressed, or implied, are my own!  They should not be
  1419. considered representative of the opinions or policies of my employer,
  1420. MacPlay, a division of Interplay Productions, Inc.
  1421.  
  1422. +++++++++++++++++++++++++++
  1423.  
  1424. >From Chris Anthes <chrisa@dsea.com>
  1425. Date: Thu, 18 Aug 1994 17:25:43 GMT
  1426. Organization: DSEA
  1427.  
  1428. In article <phixusCuq9E4.8tG@netcom.com> Chris DeSalvo, phixus@netcom.com
  1429. writes:
  1430. >: If you have your own custom filter proc, make sure it calls the Standard
  1431. >: proc with GetStdFilterProc().
  1432. >
  1433. >That is probably the case, I do indeed have a custom event filter on
  1434. >this dialog.  I will check it out.
  1435.  
  1436. Even if you are using a custom dialog filter, you can still use
  1437. SetDialogDefaultItem, SetDialogCancelItem, and SetDialogTrackCursor. 
  1438. After you are done processing whatever you need to in your filter, make a
  1439. call to the Standard Dialog Filter.  This is all explained in detail in
  1440. Mac Tech Note #304.  Here is the code I use to handle custom dialog
  1441. filters.  This code differs slightly because I use returnVal to determine
  1442. whether or not I need to call the standard dialog routines.  I did this I
  1443. think because I needed to filter Return & Enter and alias them to Tab when
  1444. all of the data in my dialog wasn't entered (e.g. OK button grayed out).
  1445.  
  1446. /***** myDialogFilter *****/
  1447.  
  1448. pascal Boolean    myDialogFilter( DialogPtr theDialog, EventRecord
  1449.         *theDialogEvent, short *theDialogItem )
  1450. {
  1451.     ModalFilterProcPtr        standardProc;
  1452.     Boolean                    returnVal = false;
  1453.     WindowPtr                temp;
  1454.  
  1455.     //
  1456.     // Do all of your filter processing here...
  1457.     //
  1458.  
  1459.     // Go to the standard dialog filter if the event wasn't completely
  1460.     // handled
  1461.     if ( returnVal != true ) {
  1462.         GetPort( &temp );
  1463.         SetPort( theDialog );
  1464.         GetStdFilterProc( &standardProc );
  1465.         returnVal = ((ModalFilterProcPtr)standardProc)( theDialog,
  1466.             theDialogEvent, theDialogItem );
  1467.         SetPort( temp );
  1468.     }
  1469.     
  1470.     return( returnVal );
  1471. }
  1472.  
  1473. If you need some more info on this, send me an email.
  1474.  
  1475. Cya L8r,
  1476.  
  1477. Chris
  1478.  
  1479. ***************************************************************************
  1480. *                             *                                           *
  1481. *  It's not the crime,        *  Chris Anthes          (chrisa@dsea.com)  *
  1482. *  It's not the thought,      *  ---------------------------------------  *
  1483. *  It's not the deed,         *  DAINIPPON SCREEN ENGINEERING OF AMERICA  *
  1484. *                             *  3700 West Segerstrom Avenue              *
  1485. *  IT'S IF YOU GET CAUGHT!!!  *  Santa Ana, CA 92704                      *
  1486. *                             *                                           *
  1487. ***************************************************************************
  1488.  
  1489. +++++++++++++++++++++++++++
  1490.  
  1491. >From b-clark@nwu.edu (Brian Clark)
  1492. Date: Wed, 17 Aug 1994 11:00:34 -0500
  1493. Organization: Northwestern University
  1494.  
  1495. In article <phixusCuo7K0.Fzr@netcom.com>, phixus@netcom.com (Chris
  1496. DeSalvo) wrote:
  1497.  
  1498. > Think Reference mentions two traps:
  1499. > SetDialogDefaultItem and
  1500. > SetDialogCancelItem
  1501. > Are these entries just place holders or is there some magic I have not
  1502. > learned to get them to work?
  1503.  
  1504. They work fine, but only when the standard system dialog filter proc is
  1505. called (either because you haven't specified your own, or you explicitly
  1506. call it from within your custom filter proc.
  1507.  
  1508. +++++++++++++++++++++++++++
  1509.  
  1510. >From andrew@csgrad.cs.vt.edu (Andrew Southwick)
  1511. Date: 19 Aug 1994 14:02:53 GMT
  1512. Organization: IBM SWSD, Lexington, KY, USA
  1513.  
  1514. b-clark@nwu.edu (Brian Clark) writes:
  1515. > phixus@netcom.com (Chris DeSalvo) wrote:
  1516. >> SetDialogDefaultItem and
  1517. >> SetDialogCancelItem
  1518.  
  1519. >They work fine, but only when the standard system dialog filter proc is
  1520. >called (either because you haven't specified your own, or you explicitly
  1521. >call it from within your custom filter proc.
  1522.  
  1523. Also, these traps have to be defined by the headers that you are using.
  1524. The headers that come with ThinkC up til (at least) 6.0 don't define
  1525. them, so you have to do one of those
  1526.     void SetDialogDefaultItem( blah ) 0xYYYY;
  1527. things at the top of your code.  Sorry, don't have the trap number with me.
  1528. It's mentioned in the ThinkC Programming Primer, though, and ThinkRef
  1529. might have the trap numbers, too.
  1530.  
  1531.  
  1532. Best Premises,                                      andrew@csgrad.cs.vt.edu
  1533. Andrew R. Southwick                                 asouthwick@vnet.ibm.com
  1534.  
  1535.  
  1536. +++++++++++++++++++++++++++
  1537.  
  1538. >From Dave Falkenburg <falken@apple.com>
  1539. Date: Thu, 1 Sep 1994 16:52:43 GMT
  1540. Organization: Apple Computer, Inc.
  1541.  
  1542. In article <phixusCuo7K0.Fzr@netcom.com> Chris DeSalvo, phixus@netcom.com
  1543. writes:
  1544. >SetDialogDefaultItem and
  1545. >SetDialogCancelItem
  1546. >
  1547. >The traps are definied in the Universal Headers but they don't seem to
  1548. >work.  They are not documented in the Dialog Manager section of
  1549. >NIM:Toolbox Essentials.
  1550.  
  1551. They were documented in the Technotes, but do to a race condition were never
  1552. included with IM:Toolbox Essentials. During the PowerPC effort, we figured
  1553. this out and added them to the headers.
  1554.  
  1555. >Are these entries just place holders or is there some magic I have not
  1556. >learned to get them to work?
  1557.  
  1558. Yes they work, but you must supply a dialog filter proc which calls
  1559. StdFilterProc in order to make them work as advertised. See technote
  1560. TB 37 "Pending Update Perils".
  1561.  
  1562. Whenever using modal dialogs it is best to always supply a filter proc
  1563. to keep pending updates in your application from blocking background
  1564. processing. The same technote which documents these calls explains this
  1565. problem in more detail.
  1566.  
  1567. Watch for an upcomming issue of MacTech, which will include "Sprocket",
  1568. an application shell with code that deals with these calls.
  1569.  
  1570. -Dave Falkenburg
  1571. -Apple Computer, Inc.
  1572.  
  1573. ---------------------------
  1574.  
  1575. >From Bernd Mathiske <mathiske@dbis1.informatik.uni-hamburg.de>
  1576. Subject: Stack sniffer - how can I turn it off?
  1577. Date: 16 Aug 1994 18:02:53 GMT
  1578. Organization: Universitaet Hamburg
  1579.  
  1580. Dear internet-community!
  1581.  
  1582. Help!
  1583. Do you know how I can get rid of the very annoying vbl-"stack sniffer"
  1584. that causes error #28 when I move the stack pointer into the heap?
  1585. I do not see the point why I should not have my stacks allocated
  1586. where I like them to be, in particular if there are several of them
  1587. between which I want to switch around, the latter allowing me to
  1588. implement coroutines.
  1589.  
  1590. Any idea anybody?
  1591.  
  1592. %  ======================================================
  1593. %                Bernd Mathiske
  1594. %  voice:        +49-40/54715-330
  1595. %  e-mail:       mathiske@dbis1.informatik.uni-hamburg.de
  1596. %  snail mail:   Universitaet Hamburg
  1597. %                Vogt-Koelln-Strasse 30
  1598. %                D-22527 Hamburg, Deutschland
  1599. %  ======================================================
  1600.  
  1601. +++++++++++++++++++++++++++
  1602.  
  1603. >From bobo@reed.edu (Eric Bowman)
  1604. Date: 17 Aug 1994 04:24:16 GMT
  1605. Organization: Reed College,  Portland, Oregon
  1606.  
  1607. In article <32qv0d$7t1@rzsun02.rrz.uni-hamburg.de>,
  1608. Bernd Mathiske  <mathiske@dbis1.informatik.uni-hamburg.de> wrote:
  1609. >Do you know how I can get rid of the very annoying vbl-"stack sniffer"
  1610. >that causes error #28 when I move the stack pointer into the heap?
  1611. >I do not see the point why I should not have my stacks allocated
  1612. >where I like them to be, in particular if there are several of them
  1613. >between which I want to switch around, the latter allowing me to
  1614. >implement coroutines.
  1615.  
  1616. To disable the stack sniffer,
  1617.  
  1618. Ptr oldTopOfStack = LMGetStackLowPoint();
  1619. LMSetStackLowPoint(NULL);
  1620.  
  1621. To undo the damage,
  1622.  
  1623. LMSetStackLowPoint(oldTopOfStack);
  1624.  
  1625. cheers,
  1626. bobo
  1627.  
  1628. +++++++++++++++++++++++++++
  1629.  
  1630. >From quinn@cs.uwa.edu.au (Quinn "The Eskimo!")
  1631. Date: Wed, 17 Aug 1994 17:20:16 +0800
  1632. Organization: Department of Computer Science, The University of Western Australia
  1633.  
  1634. In article <32qv0d$7t1@rzsun02.rrz.uni-hamburg.de>, Bernd Mathiske
  1635. <mathiske@dbis1.informatik.uni-hamburg.de> wrote:
  1636.  
  1637. >Do you know how I can get rid of the very annoying vbl-"stack sniffer"
  1638. >that causes error #28 when I move the stack pointer into the heap?
  1639. >I do not see the point why I should not have my stacks allocated
  1640. >where I like them to be, in particular if there are several of them
  1641. >between which I want to switch around, the latter allowing me to
  1642. >implement coroutines.
  1643.  
  1644. No it won't (:  There are problems with putting the stack in the heap,
  1645. specifically a number of toolbox calls expect the stack to be above the
  1646. heap and get very upset when it isn't.  If you want to do co-routines, use
  1647. the Thread Manager.
  1648.  
  1649. btw You can disable the stack sniffer by putting 0 into the low memory
  1650. global StkLowPt.  I've also seen Apple code that disables it by patching
  1651. SysError and preventing error 28 getting through (:
  1652. -- 
  1653. Quinn "The Eskimo!"      <quinn@cs.uwa.edu.au>     "Support HAVOC!"
  1654. Department of Computer Science, The University of Western Australia
  1655.  
  1656. +++++++++++++++++++++++++++
  1657.  
  1658. >From ari@world.std.com (Ari I Halberstadt)
  1659. Date: Wed, 17 Aug 1994 17:54:25 GMT
  1660. Organization: The World Public Access UNIX, Brookline, MA
  1661.  
  1662. In article <quinn-1708941720160001@edu-dynamic1.educ.ecel.uwa.edu.au>,
  1663. Quinn "The Eskimo!" <quinn@cs.uwa.edu.au> wrote:
  1664. >In article <32qv0d$7t1@rzsun02.rrz.uni-hamburg.de>, Bernd Mathiske
  1665. ><mathiske@dbis1.informatik.uni-hamburg.de> wrote:
  1666. >
  1667. >>Do you know how I can get rid of the very annoying vbl-"stack sniffer"
  1668. >>that causes error #28 when I move the stack pointer into the heap?
  1669. >>I do not see the point why I should not have my stacks allocated
  1670. >>where I like them to be, in particular if there are several of them
  1671. >>between which I want to switch around, the latter allowing me to
  1672. >>implement coroutines.
  1673. >
  1674. >No it won't (:  There are problems with putting the stack in the heap,
  1675. >specifically a number of toolbox calls expect the stack to be above the
  1676. >heap and get very upset when it isn't.  If you want to do co-routines, use
  1677. >the Thread Manager.
  1678.  
  1679. You can fool them into being happy by setting 3 low-memory globals.
  1680. It's tricky though.
  1681. -- 
  1682. Ari Halberstadt                                 ari@world.std.com
  1683. One generation passes away, and another generation comes: but the
  1684. earth abides for ever. -- Ecclesiastes, 1:4.
  1685.  
  1686. +++++++++++++++++++++++++++
  1687.  
  1688. >From sparent@mv.us.adobe.com (Sean Parent)
  1689. Date: Wed, 17 Aug 1994 22:48:18 GMT
  1690. Organization: Adobe Systems Incorporated
  1691.  
  1692. It is tricky to fool the toolbox because one of the lowmem globals that
  1693. has to be set is the HiHeapMark (thus confusing the memory manager). The
  1694. cleanest way (other than using the Thread Manager) that I have seen is to
  1695. just BlockMoveData your alternate stacks into the stack. It costs a few
  1696. extra cycles but can save you a boat load of time getting other stuff
  1697. working.
  1698.  
  1699. In article <Cuoxqq.L94@world.std.com>, ari@world.std.com (Ari I
  1700. Halberstadt) wrote:
  1701.  
  1702. > In article <quinn-1708941720160001@edu-dynamic1.educ.ecel.uwa.edu.au>,
  1703. > Quinn "The Eskimo!" <quinn@cs.uwa.edu.au> wrote:
  1704. > >In article <32qv0d$7t1@rzsun02.rrz.uni-hamburg.de>, Bernd Mathiske
  1705. > ><mathiske@dbis1.informatik.uni-hamburg.de> wrote:
  1706. > >
  1707. > >>Do you know how I can get rid of the very annoying vbl-"stack sniffer"
  1708. > >>that causes error #28 when I move the stack pointer into the heap?
  1709. > >>I do not see the point why I should not have my stacks allocated
  1710. > >>where I like them to be, in particular if there are several of them
  1711. > >>between which I want to switch around, the latter allowing me to
  1712. > >>implement coroutines.
  1713. > >
  1714. > >No it won't (:  There are problems with putting the stack in the heap,
  1715. > >specifically a number of toolbox calls expect the stack to be above the
  1716. > >heap and get very upset when it isn't.  If you want to do co-routines, use
  1717. > >the Thread Manager.
  1718. > You can fool them into being happy by setting 3 low-memory globals.
  1719. > It's tricky though.
  1720. > -- 
  1721. > Ari Halberstadt                                 ari@world.std.com
  1722. > One generation passes away, and another generation comes: but the
  1723. > earth abides for ever. -- Ecclesiastes, 1:4.
  1724.  
  1725. -- 
  1726. Sean Parent
  1727. sparent@mv.us.adobe.com
  1728. "The critical driver of every successful project is its focused ruthlessness."
  1729.         Grady Booch
  1730.  
  1731. +++++++++++++++++++++++++++
  1732.  
  1733. >From ari@world.std.com (Ari I Halberstadt)
  1734. Date: Thu, 18 Aug 1994 03:00:21 GMT
  1735. Organization: The World Public Access UNIX, Brookline, MA
  1736.  
  1737. In article <sparent-1708941448180001@macb042.mv.us.adobe.com>,
  1738. Sean Parent <sparent@mv.us.adobe.com> wrote:
  1739. >It is tricky to fool the toolbox because one of the lowmem globals that
  1740. >has to be set is the HiHeapMark (thus confusing the memory manager). The
  1741. >cleanest way (other than using the Thread Manager) that I have seen is to
  1742. >just BlockMoveData your alternate stacks into the stack. It costs a few
  1743. >extra cycles but can save you a boat load of time getting other stuff
  1744. >working.
  1745.  
  1746. There is a third solution. It is very similar to the Thread Manager,
  1747. but has context switch times from over 2 to nearly 4 times faster than
  1748. the Thread Manager. It's my free Thread Library (not to be confused
  1749. with Apple's ThreadsLib). It's called ThreadLib-10d4.hqx (or some
  1750. similar name, depending on the archive), includes full source code,
  1751. and is available from info-mac mirrors in the dev/src directory, and
  1752. from the alt.sources.mac archive. I tested it under emulation on a
  1753. PowerPC, and it ran fine. It has been tested on a Plus, Quadra 950,
  1754. and PowerPC, with systems 6.0.5, 7Pro, and whatever the PowerPC needed
  1755. (7.1.1, or something like that). My Thread Library does not run
  1756. in native PPC mode, and does not support preemptive threads.
  1757. -- 
  1758. Ari Halberstadt                                 ari@world.std.com
  1759. One generation passes away, and another generation comes: but the
  1760. earth abides for ever. -- Ecclesiastes, 1:4.
  1761.  
  1762. +++++++++++++++++++++++++++
  1763.  
  1764. >From Clinton Bauder <gecko1@applelink.apple.com>
  1765. Date: Tue, 23 Aug 1994 19:28:07 GMT
  1766. Organization: Apple Computer Inc.
  1767.  
  1768. In article <32qv0d$7t1@rzsun02.rrz.uni-hamburg.de> Bernd Mathiske,
  1769. mathiske@dbis1.informatik.uni-hamburg.de writes:
  1770. >Do you know how I can get rid of the very annoying vbl-"stack sniffer"
  1771. >that causes error #28 when I move the stack pointer into the heap?
  1772. >I do not see the point why I should not have my stacks allocated
  1773. >where I like them to be, in particular if there are several of them
  1774. >between which I want to switch around, the latter allowing me to
  1775. >implement coroutines.
  1776. >
  1777. >Any idea anybody?
  1778.  
  1779. You should use the Thread Manager if you can.  If you can't - say your
  1780. code is a driver or something - then you can disable the Stack Sniffer by
  1781. clearing the low memory global StkLowPt (0x110 - 32 bits).  Of course
  1782. when you are done using your private stack you should put it back to what
  1783. it was.  Also your stack should be at least 4K in size plus whatever you
  1784. expect to use in your own code.  This should be sufficient for most
  1785. interrupt code which might end up using your stack.  Note that this is
  1786. not the worlds most forward compatible kind of programming but if you can
  1787. accept the possibility of future incompatibility then this is a useful
  1788. technique.
  1789.  
  1790. Clinton
  1791. - -------------------------------------------------------------
  1792. Clinton Bauder        | Opinions expressed are very likely to
  1793. SCSI Grunt and Chief  | be entirely different from the official
  1794. Herpetoculturist      | party line of Apple Computer Inc.
  1795. Apple Computer Inc.   | Support your local herp society.
  1796. - -------------------------------------------------------------
  1797.  
  1798. +++++++++++++++++++++++++++
  1799.  
  1800. >From ari@world.std.com (Ari I Halberstadt)
  1801. Date: Wed, 24 Aug 1994 01:37:38 GMT
  1802. Organization: The World Public Access UNIX, Brookline, MA
  1803.  
  1804. In article <1994Aug23.192807.4763@gallant.apple.com>,
  1805. Clinton Bauder  <gecko1@applelink.apple.com> wrote:
  1806. >it was.  Also your stack should be at least 4K in size plus whatever you
  1807. >expect to use in your own code.  This should be sufficient for most
  1808. >interrupt code which might end up using your stack.  Note that this is
  1809.  
  1810. Actually, you want at least MinStack bytes, plus whatever your app
  1811. will need. MinStack is a low-mem global.
  1812.  
  1813.  
  1814. -- 
  1815. Ari Halberstadt                                 ari@world.std.com
  1816. One generation passes away, and another generation comes: but the
  1817. earth abides for ever. -- Ecclesiastes, 1:4.
  1818.  
  1819. +++++++++++++++++++++++++++
  1820.  
  1821. >From Dave Falkenburg <falken@apple.com>
  1822. Date: Wed, 31 Aug 1994 16:44:55 GMT
  1823. Organization: Apple Computer, Inc.
  1824.  
  1825. In article <32qv0d$7t1@rzsun02.rrz.uni-hamburg.de> Bernd Mathiske,
  1826. mathiske@dbis1.informatik.uni-hamburg.de writes:
  1827. >Dear internet-community!
  1828. >
  1829. >Help!
  1830. >Do you know how I can get rid of the very annoying vbl-"stack sniffer"
  1831. >that causes error #28 when I move the stack pointer into the heap?
  1832. >I do not see the point why I should not have my stacks allocated
  1833. >where I like them to be, in particular if there are several of them
  1834. >between which I want to switch around, the latter allowing me to
  1835. >implement coroutines.
  1836. >
  1837. >Any idea anybody?
  1838.  
  1839. The stack sniffer can be turned off by zeroing out STKLOWPT. However, this
  1840. isn't enough to keep the Macintosh working if you plan on calling the
  1841. toolbox from your coroutines.
  1842.  
  1843. The supported way of doing coroutines on the Macintosh is to use the
  1844. Thread Manager. The Thread Manager is available in the form of an
  1845. extension for System 7.0 or later, and has been rolled into the base
  1846. system software in System 7.5.
  1847.  
  1848. The current version of the extension is 2.0.1, which includes support for
  1849. PowerPC machines.
  1850.  
  1851. -Dave Falkenburg
  1852. -Apple Computer, Inc.
  1853.  
  1854. ---------------------------
  1855.  
  1856. End of C.S.M.P. Digest
  1857. **********************
  1858.  
  1859.  
  1860. ˇ